using UnityEngine;

// 巡逻状态
public class BoarPatrolState : BaseState
{
  public override void OnEnter(Enemy enemy)
  {
    curEnemy = enemy;
    curEnemy.curSpeed = curEnemy.normalSpeed;
  }

  public override void LogicUpdate()
  {
    //TODO：一旦发现敌人 切换到追击状态 ChaseState
    if (curEnemy.FoundPlayer())
    {
      curEnemy.SwitchState(NPCState.Chase);
    }

    if (!curEnemy.physicCheck.isGround || curEnemy.physicCheck.touchHeadWall)
    {
      curEnemy.isWait = true;
      curEnemy.anim.SetBool("walk", false);
    }
    else
    {
      curEnemy.anim.SetBool("walk", true);
    }
  }

  public override void PhysicsUpdate()
  {
  }

  public override void OnExit()
  {
    // throw new System.NotImplementedException();
    curEnemy.anim.SetBool("walk", false);
  }
}
